<extend name="Base/common"/>
<block name="header">
    <include file="Public/nav"/>
</block>
<block name="body">




    <link href="__CSS__/common.css" rel="stylesheet" type="text/css">
    <link href="__CSS__/radios.css" rel="stylesheet" type="text/css">
    <div style="position: relative;height: 130px;margin-top: 90px;background: white;margin-bottom: 10px">
        <div style="position: absolute;left: 50px;;top: -90px;">
            <img style="width: 180px;height: 180px;border: 1px solid #eee" src="__IMG__/shop.jpg"/>
        </div>
        <div style="margin-left: 250px;padding-top:5px;position: relative">
            <h3 style="margin-top: 10px"><strong> 店铺</strong> <sub>Shop</sub></h3>

            <p>欢迎入驻OpenSNS云市场，早期入驻开发商将会享受更多的优惠。</p>

            <div>
                <a class="btn btn-warning" href="http://os.opensns.cn/book/index/read/section_id/163.html"
                   target="_blank"><i class="icon-file-text"></i> 开发者指南</a>
                &nbsp; &nbsp; <a class="btn btn-success" href="{:U('Admin/shop')}"
                                 href="{:U('Admin/shop')}">+
                入驻云市场 &nbsp;</a> <!--  <button class="btn btn-danger">+ 关注 &nbsp;</button>-->
            </div>
            <div class=""
                 style="margin-top: 10px;margin-bottom: 10px;position: absolute;right: 10px;top: 20px;width: 250px">
                <form action="__SELF__" method="post">
                    <div class="search_input">
                        <div class="input-group">

                            <input name="keywords" type="text" class="form-control" placeholder="输入店铺名称"
                                   value="{$keywords}">
      <span class="input-group-btn">
        <button class="btn btn-default" type="submit">搜索</button>
      </span>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>


    <!--推荐模板部分-->
    <eq name="can_manage" value="1">
        <!--如果允许管理-->
        <div id="frm-post-popup" class="white-popup mfp-hide" style="position: relative">

            <h2>选择店铺添加</h2>

            <div class="aline" style="margin-bottom: 10px"></div>
            <div style="margin-bottom: 10px ">选择店铺：</div>
            <select id="add_goods_id" data-placeholder="选择推荐的主题" class="chosen-select form-control" tabindex="2"
                    value="33">
                <volist name="goods" id="vo">
                    <option value="{$vo.id}">{$vo.title}</option>
                </volist>
            </select>

            <div class="margin-top-10">
                <button class="btn btn-success btn-block" onclick="add_goods()">+ 添加</button>
            </div>

            <div>
            </div>
            <link href="__ZUI__/lib/chosen/chosen.css" type="text/css" rel="stylesheet"/>
            <script src="__ZUI__/lib/chosen/chosen.js"></script>

            <script>
                $(function () {

                    $('.open-popup-link').magnificPopup({
                        type: 'inline',
                        midClick: true, // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
                        closeOnBgClick: false,
                        callback: function () {
                            if ($.fn.chosen) $('.chosen-select').chosen();
                        }
                    });
                });

                function add_goods() {
                    $('.mfp-close').click();
                    $.post(U('Appstore/Index/setRecommonedGoods'), {
                        id: $('#add_goods_id').val(),
                        entity:5
                    }, function (msg) {
                        if (msg.status) {
                            toast.success(msg.info + '页面即将刷新。')
                            setTimeout('location.reload()', 1500)
                        } else {
                            toast.error(msg.info)
                        }

                    }, 'json');
                }
            </script>
        </div>
    </eq>
    <if condition="$can_manage||count($recommond_goods)">
        <link href="__JS__/datouwang.css" type="text/css" rel="stylesheet">
        <div class="common-block margin-bottom-10 recom ">
            <header>
                小编推荐
                <div class="fr" style="margin-top: -13px;">
                    <ul id="tabT04" class="tab-T-3 mt20 clearfix">
                        <php>
                            $recommond_num=count($recommond_goods);
                            if($can_manage==1){
                            $recommond_num=$recommond_num+1;
                            }
                            $num=$recommond_num/6;
                            if(intval($num)<$num){
                            $num=intval($num)+1;
                            }else{
                            $num=intval($num);
                            }
                            if($num>1){
                            for($i=0;$i<$num;$i++){
                            if($i==0){
                            $curr='cur';
                            }else{
                            $curr='';
                            }
                        </php>
                        <li class="{$curr}"></li>
                        <php>}}</php>
                    </ul>
                </div>
            </header>
            <section>
                <div class="rowE">
                    <div class="bd ">
                        <div id="sca1" class="warp-pic-list">
                            <div id="wrapBox1" class="wrapBox">
                                <ul id="count1" class="count clearfix">
                                    <volist name="recommond_goods" id="vo">
                                        <li>
                                            <a href="{:U('Index/shop',array('id'=>$vo['uid']))}" class="img_wrap">{$vo.logo|display_cover=168,168}</a>
                                            <php>if($vo['gold'] || $vo['official'])
                                                $class='text-danger';else{
                                                $class='';
                                                }
                                            </php>
                                            <div class="text-area">
                                                <p class="text-ellipsis">
                                                    <a class="{$class}" href="{:U('Index/shop',array('id'=>$vo['uid']))}">{$vo.title}</a>
                                                    {$vo|display_icon}
                                                </p>

                                                <p class="text-muted text-ellipsis">
                                                    {$vo.user.nickname}
                                                </p>
                                                <p><span>评级：{$vo|display_star}</span></p>
                                            </div>
                                        </li>
                                    </volist>
                                    <eq name="can_manage" value="1">
                                        <li>
                                            <a href="#frm-post-popup" class="open-popup-link">
                                                <div class="img_wrap"
                                                     style="height:165px;background: #333;color:white;font-size: 120px;text-align: center;line-height:140px">
                                                    +
                                                </div>
                                                <div class="text-area"
                                                     style="  height: 100px;  line-height: 59px;  font-size: 32px;  color: #666;text-align: center;padding-left: 0 ">
                                                    添加店铺
                                                </div>
                                            </a>
                                        </li>
                                    </eq>
                                </ul>
                            </div>
                            <php>
                                if($num>1){
                            </php>
                            <a id="right1" class="prev icon btn-recom"></a>
                            <a id="left1" class="next icon btn-recom"></a>
                            <php>}</php>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </if>
    <!--推荐模板部分 end-->

    <div class="container common-block templet">
        <header>

        </header>
        <section>
            <div class="up_search row">
                <div class="col-xs-9">
                    <ul class="nav nav-secondary">


                        <a class=" btn btn-default" href="{:U('shops',array_merge($param,array('order'=>'create')))}">创店时间
                            <eq name="param.order" value="create">从新到旧 ↓</eq>
                        </a>
                        <a href="{:U('shops',array_merge($param,array('order'=>'sales_count')))}"
                           class=" btn btn-default">销量
                            <eq name="param.order" value="sales_count">从高到低 ↓</eq>
                        </a>
                        <!--    <a href="{:U('theme',array_merge($param,array('order'=>'download')))}"
                               class="btn btn-default">下载量
                                <eq name="param.order" value="download">从高到低 ↓</eq>
                            </a>-->
                        <a href="{:U('shops',array_merge($param,array('order'=>'goods_count')))}"
                           class="btn btn-default">商品数
                            <eq name="param.order" value="goods_count">从高到低 ↓</eq>
                        </a>
                        <a href="{:U('shops',array_merge($param,array('order'=>'star')))}"
                           class="btn btn-default">评级
                            <eq name="param.order" value="star">从高到低 ↓</eq>
                        </a>
                    </ul>
                </div>
                <div class="col-xs-3 text-right filter">
                    <a id="official_a" href="{:U('shops',array_merge($param,array('filter_official'=>$official)))}">
                        <eq name="param.filter_official" value="1">
                            <img src="__IMG__/checked.jpg"/>
                            <else/>
                            <img src="__IMG__/unchecked.jpg"/>
                        </eq>
                         <span style="display: inline-block;vertical-align: middle">官方认证</span>
                        <img title="官方认证店" alt="官方认证店" src="__IMG__/icon-official.png"/>
                    </a>&nbsp;&nbsp;

                    <a style="" id="gold_a" href="{:U('shops',array_merge($param,array('filter_gold'=>$gold)))}">
                        <eq name="param.filter_gold" value="1">
                            <img src="__IMG__/checked.jpg"/>
                            <else/>
                            <img src="__IMG__/unchecked.jpg"/>
                        </eq>
                        <span style="display: inline-block;vertical-align: middle">金牌店铺</span> <img title="金牌店铺" alt="金牌店铺" src="__IMG__/icon-gold.png"/></a>
                </div>

            </div>

            <div class="clearfix margin-top-10"></div>

            <!-- 插件列表部分-->


            <ul class="shop-list margin-top-15">
                <volist name="lists.data" id="vo">
                    <li class="row">
                        <div class="col-xs-2" style="width: 140px">
                            <div>
                                <a href="{:U('Index/shop',array('id'=>$vo['uid']))}"><img class="logo"
                                                                                          src="{$vo.logo|thumb=120,120}"/></a>
                            </div>

                        </div>
                        <div class="col-xs-5">
                            <h3 class="title">
                                <php>if($vo['gold'] || $vo['official'])
                                    $class='text-danger';else{
                                    $class='';
                                    }
                                </php>
                                <a class="{$class}" href="{:U('Index/shop',array('id'=>$vo['uid']))}">{$vo.title}</a>
                                {$vo|display_icon}
                            </h3>
                            <p class="text-muted" style="height: 34px;overflow: hidden;line-height: 17px">
                                {$vo.ad}
                            </p>

                            <p class="evaluation">
                                官方认证：<span class="text-muted">{$vo.evaluation|default='暂未认证'}</span>
                            </p>

                            <p>
                                <a href="{:U('Index/shop',array('id'=>$vo['uid']))}"
                                   class="btn btn-success btn-xs">进入店铺</a>
                                <if condition="$vo['uid'] neq get_uid()">
                                    &nbsp;<a class="btn btn-default btn-xs"
                                             onclick="talker.start_talk({$vo.uid})">联系我</a>
                                </if>

                            </p>

                        </div>
                        <div class="div-col-xs-7 text-right">
                            <table class="text-center data-cols" style="display: inline-block">
                                <tr>
                                    <td style="width: 100px">
                                        创店<br/>
                                        <php>
                                            echo number_format(ceil((time()-$vo['create_time'])/86400),0,null,'')
                                        </php>
                                        天
                                    </td>
                                    <td style="width: 120px">销量<br/><span class="text-danger">{$vo.sales_count}</span>
                                    </td>
                                    <td style="width: 120px">商品<br/><span class="text-success">{$vo.goods_count}</span>
                                    </td>
                                    <td style="width: 140px ">评级<br/>
                                       {$vo|display_star}
                                    </td>
                                </tr>
                            </table>
                            <div class="text-right margin-top-10">
                                <p><img class="avatar-img" style="width: 32px" src="{$vo.user.avatar128}">
                                    {$vo.user.space_link}</p>
                            </div>
                        </div>
                    </li>
                </volist>


            </ul>


            <!-- 插件列表部分-->
            <div class="">
                {$lists.html}
            </div>
        </section>

    </div>

</block>